import Vue from 'vue'
import VueRouter from 'vue-router'


Vue.use(VueRouter)
//解决vue路由重复导航错误
//获取原型对象上的push函数
const originalPush = VueRouter.prototype.push
//修改原型对象中的push方法
VueRouter.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err)
}

// 完整路由代码
export default new VueRouter({
    mode: "history",
    routes: [
        {
            path: '/',
            name: 'login',
            component: () => import('@/views/login/Login'),
        },
        {
            path: '/main',
            name: 'main',
            component: () => import('@/layout/Main'),
            children: []
        }
    ]
})
